package com.bkhc.order.entity;


import com.bkhc.common.annotation.Uid;
import com.bkhc.common.enu.IndentityEnum;
import com.bkhc.common.enu.OrderStatusEnum;
import com.bkhc.common.listener.DataEntityListener;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Data
@Table(name = "tbl_order_t")
@EntityListeners({AuditingEntityListener.class, DataEntityListener.class})
public class Order {

    @GeneratedValue(strategy = GenerationType.AUTO)
    @Id
    private Integer id ;
    @Uid
    @Column(name = "order_code")
    private String orderCode;

    @Column(name = "product_code")
    private String productCode;

    @Column(name = "product_name")
    private String productName;

    @Column(name = "brand")
    private String brand;

    @Column(name = "brand_name")
    private String brandName;

    @Column(name = "userId")
    private String userId;

    @Column(name = "username")
    private String username;

    @Column(name = "partner_code")
    private String partnerCode;

    /**
     * 收货人
     */
    @Column(name = "receiver")
    private String receiver;
    /**
     * 收货人地址
     */
    @Column(name = "mobile")
    private String mobile;

    @Column(name = "price_tatol")
    private String priceTatol;

    @Column(name = "address")
    private String address;
    @Column(name="identity")
    private String identity;
    /**
     * 期望交货时间
     */
    @Column(name = "expect_date")
    private String expectDate;

    @Column(name = "business_group")
    private String businessGroup;

    @Column(name = "business_group_member")
    private String businessGroupMember;

    @Column(name = "status")
    private String orderStatus;
    /**
     * 包装要求
     */
    @Column(name="packing")
    private String packing;

    @Column(name = "remark")
    private String remark;

    @Transient
    private List<OrderItem> orderitems;

    @Column(name = "creator",updatable = false)
    private String creator;

    @Column(name = "create_date",updatable = false)
    @CreatedDate
    private Date createDate;

    @Column(name = "updator")
    private String updator;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;

    //客户提交订单  1
    //业务员审批驳回  10
    //业务员审批通过提交 11
    //业务合伙人驳回 110
    //业务合伙人通过提交至产品合伙人 111
    //产品合伙人同意,转给厂商，待厂商确认 1111
    //产品合伙人不同意 1110
    //厂商确认订单 11111
    //厂商取消订单 11110
    @Column(name = "audit_status")
    private int auditStatus;

}
